mod common;

use crate::common::dourl;
use serde_json::json;

#[tokio::test]
async fn a_plc() {
    let data = json!({
        "line": "line-one",
        "sn": "box1",
        "v": {
            "stepnum": 1,
            "state": "abc",
            "stepstart": true,
            "stepover": true,
            "outok": true,
        }
    });
    let ret = dourl(&data, "put").await.unwrap();
    assert_eq!(ret, json!({"success": true, "code": 1000, "fail": false}));

    let data = json!({
        "line": "line-one",
        "sn": "box1",
    });
    let ret = dourl(&data, "get").await.unwrap();
    assert_eq!(
        ret,
        json!({
        "code": 1000,
        "success": true,
        "fail": false,
        "data": {
            "stepnum": 1,
            "state": "abc",
            "stepstart": true,
            "stepover": true,
            "outok": true,
        }})
    );
}
